package com.qifenqian.turbot.module.adapter.restaurant

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.qifenqian.turbot.R
import com.qifenqian.turbot.module.entity.response.restaurant.CuisineEntity
import kotlinx.android.synthetic.main.item_cuisine.view.*

/**
 * @author H
 * @createTime 2018/12/25 19:03
 * @description
 * @see
 * @since
 */
class CuisineAdapter(data: List<CuisineEntity>?) : BaseQuickAdapter<CuisineEntity, BaseViewHolder>(R.layout.item_cuisine, data) {

    override fun convert(helper: BaseViewHolder, item: CuisineEntity) {
        val view = helper.itemView
        view.cb_item_cuisine.text = item.cuisineName
        view.cb_item_cuisine.isChecked = item.isChecked
        view.cb_item_cuisine.setOnCheckedChangeListener { buttonView, isChecked ->
            item.isChecked = isChecked
        }
    }
}
